const { screen, BrowserWindow } = require("electron");

module.exports = function (win) {
	win.webContents.setWindowOpenHandler(({ url }) => {
		// const { width,height } = screen.getPrimaryDisplay().workAreaSize
		const open_win = new BrowserWindow({
			// width : parseInt(width  / 10 * 8),
			// height: parseInt(height  / 10 * 8),
			// minWidth : parseInt(width  / 10 * 4),
			// minHeight: parseInt(height  / 10 * 4),
			// show: false,
			frame: true,
			parent: win,
		});
		open_win.setMenuBarVisibility(false);
		open_win.center();
		open_win.loadURL(url);
		// open_win.once("ready-to-show", () => {
		// 	open_win.show();
		// });
		return { action: "allow" };
	});
};
